cmake_minimum_required(VERSION 3.10)
project(profile_cplus LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(SOURCES
    src/main.cpp
    src/foo.cpp
    src/trace.cpp
)

add_executable(profile_cplus ${SOURCES})

# 全局插桩
target_compile_options(profile_cplus PRIVATE -finstrument-functions -g -O0)
target_link_libraries(profile_cplus PRIVATE dl pthread)

# trace.cpp 单独禁用插桩
set_source_files_properties(src/trace.cpp PROPERTIES COMPILE_FLAGS "-fno-instrument-functions")